home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 6
/
CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso
/
cucd
/
readers
/
utils
/
gui4cli
/
demos
/
lha.gc
< prev
next >
Wrap
Text File
|
1996-10-28
|
4KB
|
145 lines
G4C
; This is a simple GUI for the LHA command, showing you how to use
; the new commands to dynamically change the GUI
; LhA is : Copyright (c) 1991,92 by Stefan Boberg.
WinBig 400 50 195 100 "LHA Extract"
WinType 11110001
BOX 0 0 0 0 IN ICONDROP
;====================> GENERAL EVENTS
xOnLoad
setvar lha_extr "" ; Set the default values of our variables
setvar lha_dest Ram:
setvar lha_pack ""
setvar lha_darc Ram:MyArc.lha
setvar lha_com e
setvar lha_mode extract
setvar lha_incdir "-r -x"
setgad lha.gc 5 HIDE ; We open in extract mode, so we dont want this
GuiOpen lha.gc ; Open the gui
xOnClose ; On closing of the window...
guiquit lha.gc ; we also unload the GUI
;====================> SOURCE
; This is where you keep either the archive to extract (lha_extr), or
; the files to pack (lha_pack)
; Note we use different requesters according to the mode (lha_mode)
TEXT 10 5 80 10 "Archive to extract" 50 NOBOX
gadid 1
xBUTTON 10 15 20 12 R
if $lha_mode = extract
ReqFile -1 -1 300 -40 "Choose archive to unpack" LOAD lha_extr ""
update lha.gc 2 $lha_extr
else
ReqFile -1 -1 300 -40 "Choose file(s) to pack" MULTI lha_pack ""
update lha.gc 2 $lha_pack
endif
xTEXTIN 32 15 150 12 "" lha_extr "" 512
gadid 2
;====================> DESTINATION
; Same as above, but for destination directory (lha_dest) or
; destination archive (lha_darc)
TEXT 10 30 80 10 "Destination Directory" 50 NOBOX
gadid 3
xBUTTON 10 40 20 12 R
if $lha_mode = extract
ReqFile -1 -1 300 -40 "Choose Destination dir" DIR lha_dest ""
update lha.gc 4 $lha_dest
else
ReqFile -1 -1 300 -40 "Choose Destination Archive" SAVE lha_darc ""
update lha.gc 4 $lha_darc
endif
xTEXTIN 32 40 150 12 "" lha_dest "Ram:" 512
gadid 4
;====================> Include DIRECTORIES (Only for packing)
; This gadget we make appear when lha_mode = pack and
; disappear when lha_mode = extract (see the cycler below)
; The -r option instructs lha to recurse (include) subdirectories.
; The -x option instructs it to keep & use full paths.
; This is the way I like it.. change it if you don't.
xCHECKBOX 151 60 28 12 "Include Dirs" lha_incdir "-r -x" "" ON
gadid 5
;====================> Choose MODE (Extract/Pack)
; This cycler will choose the mode the GUI will work in, which can
; be the Pack or the Extract mode. According to the mode, we must
; change the GUI. This is a simple GUI, so the changes are few...
; NOTE :
; Herebelow, we use ChangeArg to change the name of the variable
; that the given xTEXTIN type gadget will store it's value in.
; (This is just about the most "advanced" thing you can do).
; Note that :
; - We use variable names of the same length.
; - We ChangeArg BEFORE we update the variables, otherwise the old
; variables would be overwritten with the values given.
; (You probably don't know what I'm talking about, but just keep it
; in mind..)
xCYCLER 10 80 100 14 "" lha_mode
CSTR Extract extract
CSTR Pack pack
if $lha_mode = extract
update lha.gc 1 "Archive to Extract :"
update lha.gc 3 "Destination Directory :"
changearg lha.gc 2 5 lha_extr
changearg lha.gc 4 5 lha_dest
update lha.gc 2 $lha_extr
update lha.gc 4 $lha_dest
setgad lha.gc 5 HIDE
redraw lha.gc
setwintitle lha.gc "LHA Extract"
else
update lha.gc 1 "Files to Pack :"
update lha.gc 3 "Destination Archive :"
changearg lha.gc 2 5 lha_pack
changearg lha.gc 4 5 lha_darc
update lha.gc 2 $lha_pack
update lha.gc 4 $lha_darc
setgad lha.gc 5 SHOW
redraw lha.gc
setwintitle lha.gc "LHA Pack"
endif
; According to the mode, run LHA!
xBUTTON 115 80 65 14 "Do it!"
if $lha_mode = extract
cli 'LHA e $lha_extr $lha_dest'
else
cli 'LHA $lha_incdir a $lha_darc $lha_pack'
endif